<script setup lang="ts">
import { useRandomTestingStore } from '@/pages/RandomTesting/store'

const rootStore = useRandomTestingStore()
const { plainStore, renderQuestionStore } = rootStore
const {
  disabledPre,
  disabledShowAnswer,
  disabledNext,
  loading,
  showAnswer,
  onToggleShowAnswer,
  onClickPre,
  onClickNext,
} = plainStore
const { progress } = renderQuestionStore
</script>

<template>
  <div class="footer">
    <AProgress :percent="progress" :show-info="false" />
    <div class="footer-inner">
      <AButton :disabled="disabledPre || loading" @click="onClickPre"> 上一题 </AButton>
      <AButton
        :disabled="disabledShowAnswer || loading"
        class="block-btn"
        block
        @click="onToggleShowAnswer"
      >
        {{ showAnswer ? '隐藏答案' : '查看答案' }}
      </AButton>
      <AButton :disabled="disabledNext || loading" @click="onClickNext"> 下一题 </AButton>
    </div>
  </div>
</template>

<style lang="less" scoped>
.footer {
  width: 100%;
  background-color: white;
  overflow: hidden;

  :deep(.ant-progress) {
    margin: 0;
  }

  .footer-inner {
    width: 100%;
    padding: 8px;
    overflow: hidden;
    white-space: nowrap;
    display: flex;
    justify-content: space-between;

    .block-btn {
      margin: 0 8px;
    }
  }
}
</style>
